package Ajax;

import PoJo.Student;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class AjaxServlet extends BaseServlet {

    protected void ajaxServlet1(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("utf-8");
        System.out.println("AJAX的请求收到了");
        Student student = new Student("陈俊华",1);
        Gson gson = new Gson();
        String s = gson.toJson(student);
        resp.getWriter().write(s);
    }
}
